#include<pthread.h>
#include<stdlib.h>
#include<stdio.h>

int var = 10;

void* thread(void * arg){
  for(int i=0;i<100;i++){
    printf("a");
  }
  printf("var:%d\n",var);
  int var = 12;
  printf("inner thread:%d\n", var);
}



int main(){
  pthread_t th;
  int ret;
  ret = pthread_create(&th, NULL, thread, NULL);
  if(ret != 0){
    printf("thread create error\n");
    exit(1);
  }
  printf("main thread:\n");
  pthread_join(th, NULL);
  printf("main thread var:%d", var);
  return 0;
}

